package com.zhongyu.item.consumer.controller;

import com.zhongyu.comm.pojo.ItemType;
import com.zhongyu.comm.vo.Result;
import com.zhongyu.item.consumer.client.ItemTypeClient;
import com.zhongyu.item.consumer.service.IndexDaoHangService;
import com.zhongyu.item.consumer.service.IndexFenLeiService;
import com.zhongyu.item.consumer.service.IndexService;
import com.zhongyu.item.consumer.service.ItemService;
import com.zhongyu.item.consumer.vo.DaoHangVo;
import com.zhongyu.item.consumer.vo.FenLeiVo;
import com.zhongyu.item.consumer.vo.FloorItemsVo;
import com.zhongyu.item.consumer.vo.ItemDetailVo;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class IndexController {

    @Resource
    private IndexService indexService;

    @Resource
    private IndexFenLeiService indexFenLeiService;
    @Resource
 private ItemService itemService;
    @Resource
    private IndexDaoHangService indexDaoHangService;

    @RequestMapping("/p/index/queryFloorItems")
    public Result queryFloorItems(){
      List<FloorItemsVo> floorItemsVos= indexService.searchFloorItems();
      return Result.success(floorItemsVos);
    }
    @RequestMapping("/p/index/queryAllType")
    public Result queryAllType1(){
        List<FenLeiVo> fenLeiVos=indexFenLeiService.searchFenLeis();
        return Result.success(fenLeiVos);

    }
    @RequestMapping("/p/index/queryTransverse")
    public Result queryAllType2(){
        List<DaoHangVo> daoHangVos=indexDaoHangService.searchDaoHang();
        return Result.success(daoHangVos);
    }
    @RequestMapping("/p/queryItemDetail")
  public Result queryItemDetail(@RequestBody ItemDetailVo vo){
     ItemDetailVo itemDetailVo= itemService.searchItemDetail(vo.getId());
       return Result.success(itemDetailVo);
  }
/*  @RequestMapping("/p/queryItemDetail")
  public Result queryItemDetail(Integer id){
      ItemDetailVo itemDetailVo= itemService.searchItemDetail(id);
      return Result.success(itemDetailVo);
  }*/
}
